import { uploadFile } from '@/api/fileupload'

const state = {}

const mutations = {
}

const actions = {
  // upload file
  uploadFile({ commit }, params) {
    return new Promise((resolve, reject) => {
      uploadFile(params.formData).then(response => {
        const { data } = response
        resolve(data)
      }).catch(error => {
        reject(error)
      })
    })
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

